------------------------------------------------------------------------------ - morph - Notes for using the image metamorphosis program. ------------------------------------------------------------------------------ morph takes one optional command-line argument, a master file listing the image and connection files to be loaded initially. A sample file "set1" is included which references some neat images in the "data" directory. So that all the files are found correctly, the program should be executed from the directory containing the "set1" file. To invoke it type ./morph set1 ------------------------------------------------------------------------------ - Performance - ------------------------------------------------------------------------------ The program comes up in performance mode. Pressing keys F1 through F12 will morph from the current image to that target. As many F-keys will be active as image/connection file pairs listed in the master file specified on the command line, plus any pairs added with the "Add Target to List" menu item in the Edit window. The first target selected fades up from black. Selecting an unused F-key will fade from the current image to black. The transition speed can be changed by pressing a key on the numeric keypad on the far right of the keyboard. Pressing causes changes to happen instantly, while pressing 9 sets the longest time, about 10 seconds. The program recognizes events, such as window reshapes or popup menus, only after a transition is completed. It is possible the queue up several transitions by pressing the F-Keys several times. To break out of a transition at any time and flush the queue, press and hold the Left Ctrl key until the computer beeps. "morph" has an auto-run mode which is entered by selecting that item from the popup menu in the Performance window. "Toggle Mesh" controls the display of the underlying triangle mesh used to draw all the images. This gives a little insight into how the shape change happens. "Toggle Twin Images" shows the initial and final images of a transition side- by-side, instead of dissolving from one to the other. All dissolves are done by animating the Alpha value of the color the triangle meshes are drawn in. Selecting "Edit Mode" allows the user to create or modify images or meshes used in the metamorphosis. ------------------------------------------------------------------------------ - Editing - ------------------------------------------------------------------------------ Each image used in the program is rendered by texture mapping a picture onto a flat mesh made up of triangles. Each one of a set of pictures uses a triangle mesh with the same connections as every other, though the vertices may be in different locations. Instead of simply cross-dissolving between two images, each vertex also moves from its location in the first mesh to its location in the second mesh. Since the pictures are "attached" to the mesh with a fixed texture mapping, this causes the images to distort. If corresponding vertices of each mesh are placed at corresponding points in each picture - e.g the tip of the nose to the tip of the nose, the outside of the right eye to the outside of the right eye - it looks as if the object is changing from one shape to another. To create a mesh from scratch for a series of images, start with a 256 pixel square SGI format RGB image file. For simplicity, the "morph" program only reads and writes files named "blah", so copy the image file to "blah.rgb". Run "morph" without any arguments and enter Edit mode. Select "Read file blah.rgb" from the popup menu. The image appears in the window. Choose "Add Vertices" from the menu. Clicking the left mouse button places new vertices, marked with crosses, on top of the image. In general, vertices should go at the points which need to match between images, and enough of them should be placed around the outside of the shape in the image to completely cover it with a mesh in the next step. Choose "Add Connections" from the menu. Now clicking on successive vertices builds connections between them. The order in which the vertices are connected is not important. To begin a new line of connections, click at a spot where there are no vertices to break the chain, then begin the new line. The Backspace key can be used to erase the last connection made. Different colors for connections and vertices can help distinguish specific parts of the mesh when you go to associate it with another image. To change the color of new vertices or connections, select one from the "Vertex Color" or "Connection Color" roll-over menu items. The color of existing vertices and connections cannot be changed. Choose "Select/Move" from the menu. Now clicking and dragging with the left mouse button can be used to move vertices. Holding down the Shift key accumulates vertices and connections into the selection. Clicking and dragging on a selected vertex moves all selected vertices. The Backspace key erases all selected vertices and connections. It is important that connecting lines do not cross each other, and any areas not covered by a triangle of connected vertices will not be included in the display. The mesh may be concave, or in several pieces, or contain holes, if desired. To check for problems, select "Draw Triangles" from the popup menu. This displays a colorful version of the mesh that has been created. Problems will show up as empty areas in the colored mesh. Fix them by moving vertices or adding or removing connections. The colored mesh disappears when the mouse is clicked or a menu item is selected. When a good mesh is obtained, select "Save as blah.cnx" from the menu. This saves the location of all the vertices and all connection information into an ASCII file named "blah.cnx". Immediately rename the file to keep it from being overwritten later. In addition to the image and mesh currently being edited, the program keeps a list of image/mesh pairs. It is these images that form the targets for morphing in Performance mode. To add the current image and mesh to the target list, select "Add to Target List" from the menu. To delete one of the targets from the list, move teh mouse to the "Delete Target from List" menu item. This is a roll-over menu item, and moving the mouse to the right will display the list of currently defined targets. Selecting one will delete it. "Go to Target" copies one of the targets into the slot for editing. It is important to save any editing done on the current image/mesh pair before doing this. To make changes to one of the targets in the list, it is necessary to "Go to Target", make the changes, "Add Target to List", then "Delete Target from List" to remove the old version. To start the program with a set of image/mesh pairs already in the list, create an ASCII file with the name of an image file and its mesh file on each line, like this: ... data/hippo.rgb data/hippo.cnx ... Supply the name of this file as a command-line argument when starting "morph". To add a mesh to morph into a second image, make sure the first mesh is in the current editing slot, either having just been created and saved or by copying the proper .cnx file to "blah.cnx" and selecting "Read file blah.cnx" from the menu. Then copy the second image to "blah.rgb" and select "Read file blah.rgb" from the menu. The image appears in the editing window under the old mesh. Select "Select/Move Vertices" and move the vertices into their corresponding locations for the new image. DO NOT delete or add any new vertices or connections. If this happens, re-read the "blah.cnx" file and start over. Check the validity of the mesh with "Draw Triangles". If hoels have appeared, it is because connection lines overlap. Move vertices until the mesh is complete. Select "Save as blah.cnx", rename the file to something appropriate, then select "Add Target to List" to include the new image and mesh. The morph can be tried out immediately by selecting "Performance" from the menu and pushing F1 and F2 to transition between the two. 11/26/91 tph
Source
Documentation
Reference
Subdirectories